let myApp = new Vue({
	el: '#app',
	data: {
		userList: [],
		//create
		userinfo: {
			id: '',
			name: '',
			age: '',
			sex: ''
		},
		// update
		editinfo: {
			id: '',
			name: '',
			age: '',
			sex: ''
		},
		currenIndex: 0
	},
	methods:{
		adduser(){
			this.userList.push(this.userinfo)
			this.userinfo = {
				id: '',
				name: '',
				age: '',
				sex: ''
			}
		},
		edituser(index){
			this.editinfo = JSON.parse(JSON.stringify(this.userList[index]))
			//对象浅拷贝
			this.currenIndex = index
		},
		deluser(index){
			this.userList.splice(index,1)
		},
		moduser(currenIndex){
			// this.userList[this.currenIndex] = this.editinfo
			
			// this.userList = JSON.parse(JSON.stringify(this.userList))
			
			Vue.set(this.userList,this.currenIndex,this.editinfo)
			
		}
		
		
	}

})

/*
push()
pop()
shift()
unshift()

splite()

reverse()
sort()

*/ 
